/**
 * @class ExtGames.Stack
 * @param {Array} An ordered array of cards to initialise this stack with
 * Represents an ordered stack of cards
 */
ExtGames.MayIPlayArea = function(config) {
  var config = config || {};
  
  //this.type = config.type;
  //this.opp = config.opp || 0;
    
  ExtGames.MayIPlayArea.superclass.constructor.call(this, config);
};

Ext.extend(ExtGames.MayIPlayArea, ExtGames.PlayArea, {
   
   replaceJokers: true,

  
  /**
   * Creates the markup to render this stack
   */
  onRender: function(ct, position) {
	  	  
	var label = 'Group';
	if (this.itemId.indexOf('run') > 0) {
		label = 'Run';
	}
	  
	var children = [];
	if (this.opp == 0) {
		children = [
		           {
		           	tag: 'h1',
		           	html: label
		           },
		           {
		             cls:   'x-solitaire-play x-solitaire-play-my',
		             style: 'background: url('+cardUrl+') no-repeat bottom left;'
		           }
		         ];
		
		this.el = ct.createChild({
		      cls: 'x-solitaire-hand-wrapper',
		      style: 'min-width: 72px;',
		      children: children
		    });
	}
	else {
		children = [
           {
             cls:   'x-solitaire-play x-solitaire-play-opp',
             style: 'background: url('+cardUrl+') no-repeat bottom left;'
           }
         ];
		
		this.el = ct.createChild({
		      cls: 'x-solitaire-hand-wrapper',
		      //style: 'min-width: 72px;',
		      children: children
		    });
	}
	
    
    this.stackHolder = this.el.child('.x-solitaire-play');
    
    ExtGames.PlayArea.superclass.onRender.apply(this, arguments);
  },


  
  validPlay: function() {
  	  	  	  	
  		if (!this.items || !this.items.items) {
  			return false;
  		}
  	

	  if (this.type == 0) {
		  return this.validRun(4);
	  }
	  else {
		  return this.validGroup(3);
	  }
  }
  
});